The Mission: Iconic Reefs (M:IR) project is a decades-long ambitious effort to restore seven key coral reef areas in the Florida Keys National Marine Sanctuary (FKNMS) via coral propagation and transplantation. Restoration is being carried out in planned phases along with biennial monitoring to provide a quantitative measure of restoration effects over time. The primary goal of this monitoring is to compare fish populations, coral populations, and benthic community metrics within M:IR restoration areas to those reefs in the broader Florida Keys in partnership with the National Coral Reef Monitoring Program (NCRMP). Currently, two rounds of surveying have been completed (in 2022 and 2024) to establish baseline conditions. This report focuses on coral populations and benthic community metrics; a separate report can be found for fish population assessments.
Figure 1: Map of the Florida Reef Tract with Specified M:IR Restoration Sites
Corals and benthic communities were monitored using two different surveys: a Benthic Community Assessment survey and a Coral Demographics survey (NOAA CRCP, 2022b, 2022c). The Benthic Community Assessment survey includes: 1) benthic cover (%) estimates along a 15-m transect with a line point intercept method, 2) presence/absence of Endangered Species Act (ESA)-listed coral species (NOAA National Marine Fisheries Service, 2014), 3) abundance of key macroinvertebrates, and 4) reef rugosity measurements within a 15 m x 2 m belt-transect area (NOAA CRCP, 2022b). At the same site, coral demographics were surveyed within a 10 m x 1 m belt-transect area (NOAA CRCP, 2022c). NCRMP coral demographic survey data was combined with complementarily allocated survey data from Florida Reef Resiliency Program’s Disturbance Response Monitoring (DRM). In all Coral Demographics surveys, all live coral colonies ≧ 4 cm were counted, identified to species, measured to the nearest centimeter (length, width, height), and estimates were made of the proportion per colony of any present mortality (recent or old), disease (present, slow, fast), and/or bleaching (total, partial, paling). Only live coral colonies were included in the survey; dead colonies with 100% mortality were not surveyed (e.g., colonies killed by coral disease). Juvenile corals (< 4 cm) were reported for species richness only and were not included in counts, size measurements, or estimates of condition.
A majority of the reef habitats within the seven M:IR areas ranged from 0-12 meters depth. For comparison, survey data from the NCRMP were restricted to the same depth range. The tables and figures below include: Sampling effort by strata and survey year and species-specific estimates of colony density, mean size, partial mortality, size frequency, and prevalence of bleaching and disease. Statistical comparisons were conducted between M:IR and NCRMP estimates for each survey year and between years for M:IR and NCRMP.
1 Benthic Cover Sites
Table 1. Number of benthic cover sites sampled inside and outside M:IR areas in each stratum.
Study Area
Strata Name
Strat Description
2022 Sample Number
2024 Sample Number
Inside (M:IR)
CFK01
Inshore reef, all relief types and depths
8
10
Inside (M:IR)
CFK02
Mid-channel patch reef, all relief types and depths
12
12
Inside (M:IR)
CFK03
Offshore patch reef, all relief types and depths
7
8
Inside (M:IR)
CFK04
Forereef, low relief, shallow (0-6 m)
NA
3
Inside (M:IR)
CFK05
Forereef, high relief, shallow (0-6 m)
24
33
Inside (M:IR)
CFK06
Forereef, low relief, mid-shallow (6-12 m)
4
9
Inside (M:IR)
CFK07
Forereef, high relief, mid-shallow (6-12 m)
32
28
Outside (NCRMP)
CFK01
Inshore reef, all relief types and depths
10
9
Outside (NCRMP)
CFK02
Mid-channel patch reef, all relief types and depths
21
13
Outside (NCRMP)
CFK03
Offshore patch reef, all relief types and depths
9
8
Outside (NCRMP)
CFK04
Forereef, low relief, shallow (0-6 m)
NA
6
Outside (NCRMP)
CFK05
Forereef, high relief, shallow (0-6 m)
7
9
Outside (NCRMP)
CFK06
Forereef, low relief, mid-shallow (6-12 m)
9
7
Outside (NCRMP)
CFK07
Forereef, high relief, mid-shallow (6-12 m)
10
28
2 Coral Demographic Sites
The number of coral demographic sites sampled inside and outside M:IR areas in each stratum (includes DRM data).
Study Area
Strata Name
Strat Description
2022 Sample Number
2024 Sample Number
Inside (M:IR)
CFK01
Inshore reef, all relief types and depths
12
10
Inside (M:IR)
CFK02
Mid-channel patch reef, all relief types and depths
16
12
Inside (M:IR)
CFK03
Offshore patch reef, all relief types and depths
7
11
Inside (M:IR)
CFK04
Forereef, low relief, shallow (0-6 m)
NA
4
Inside (M:IR)
CFK05
Forereef, high relief, shallow (0-6 m)
25
38
Inside (M:IR)
CFK06
Forereef, low relief, mid-shallow (6-12 m)
4
12
Inside (M:IR)
CFK07
Forereef, high relief, mid-shallow (6-12 m)
34
34
Outside (NCRMP + DRM)
CFK01
Inshore reef, all relief types and depths
27
24
Outside (NCRMP + DRM)
CFK02
Mid-channel patch reef, all relief types and depths
79
109
Outside (NCRMP + DRM)
CFK03
Offshore patch reef, all relief types and depths
37
42
Outside (NCRMP + DRM)
CFK04
Forereef, low relief, shallow (0-6 m)
4
31
Outside (NCRMP + DRM)
CFK05
Forereef, high relief, shallow (0-6 m)
21
45
Outside (NCRMP + DRM)
CFK06
Forereef, low relief, mid-shallow (6-12 m)
19
33
Outside (NCRMP + DRM)
CFK07
Forereef, high relief, mid-shallow (6-12 m)
60
61
3 Most Common and Focal M:IR Species
M:IR selected 10 focal coral species for comparison to NCRMP: Acropora palmata, Acropora cervicornis, Colpophyllia natans, Dendrogyra cylindrus, Dichocoenia stokesii, Diploria labyrinthiformis, Meandrina meandrites, Montastraea cavernosa, Pseudodiploria clivosa, and Pseudodiploria strigosa. The following table summarizes the number of observations across all stratum and survey years of each focal species and identifies the most abundant species encountered.
Table 3. Most Observed Species and Focal M:IR Species
Species
Species Code
Number of Colonies Observed
Siderastrea siderea
SID SIDE
9486
Porites astreoides
POR ASTR
4789
Stephanocoenia intersepta
STE INTE
2879
Porites porites
POR PORI
1334
Agaricia agaricites
AGA AGAR
1121
*Montastraea cavernosa
MON CAVE
1082
Siderastrea radians
SID RADI
510
Orbicella faveolata
ORB FAVE
503
Orbicella annularis
ORB ANNU
367
*Dichocoenia stokesii
DIC STOK
243
Porites furcata
POR FURC
237
Porites divaricata
POR DIVA
218
Solenastrea bournoni
SOL BOUR
192
*Colpophyllia natans
COL NATA
179
Eusmilia fastigiata
EUS FAST
120
*Diploria labyrinthiformis
DIP LABY
115
*Pseudodiploria strigosa
PSE STRI
96
*Acropora cervicornis
ACR CERV
87
*Pseudodiploria clivosa
PSE CLIV
54
*Meandrina meandrites
MEA MEAN
16
*Acropora palmata
ACR PALM
14
* indicates M:IR focal species
4 Benthic Cover Composition
Temporal trends in benthic cover of functional groups such as coral and macroalgae cover provide insight …..
Figure 2. Hard coral and macroalgae cover estimates inside and outside M:IR areas for 2022 and 2024. Significant difference in cover estimates in each of these areas was indicated by (*).
5 Species Specific Plots
Insert more text here. Sentence about surveys designed to produce population estimates of coral species. Metrics for status, trends and restoration effects(?) - density, partial mortality, mean colony size, colony size frequency, and colony size partial mortality. Only focal M:IR species are reported below
The following figures for these metrics are grouped by each focal species. Significant statistical differences are indicated for differences between survey years and between areas (MIR vs. NCRMP) for density, old mortality, and mean colony size.
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).
6 Bleaching Estimates
6.1 2022
Code
# Set path to data filesdata_2022_path <-"data/FK2022_NCRMP_DRM_MIR_corsz_ARallv2.csv"MIR_species <-c("ACR PALM", "ACR CERV", "COL NATA", "DEN CYLI", "DIC STOK", "DIP LABY", "EUS FAST", "MEA MEAN", "PSE CLIV", "PSE STRI", "MON CAVE")#Script works for the actual value but CI are not exact# tmp <- disease_bleach_prevalence_ratio_est(data_2022_path, 2022) %>%# filter(PV_TYPE == "Bleach_All") %>%# left_join(., names)names_clean <- names %>%select(SPECIES_CD, SPECIES_NAME) %>%distinct(SPECIES_CD, .keep_all =TRUE)tmp_ble_2022 <-read_csv("../Project/data/fk2022_NCRMP_MIR_sppPVbar_Ball_dom.csv") %>%left_join(., names_clean, by ="SPECIES_CD")top_species <- tmp_ble_2022 %>%group_by(SPECIES_CD) %>%summarise(mean_pv =mean(PVbar, na.rm =TRUE)) %>%arrange(desc(mean_pv)) %>%slice_head(n =10) %>%pull(SPECIES_CD)tmp_filtered <- tmp_ble_2022 %>%filter(SPECIES_CD %in%union(top_species, MIR_species)) ##Add a * for those MIR speciestmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0("*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME)))#Factor re-order for aesthetics tmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(PVbar), 0, PVbar), .desc =FALSE)) %>%mutate(analysis_group =recode(analysis_group,"MIR_GRP"="MIR","NCRMP_GRP"="NCRMP + DRM"))plt_bleach <- tmp_filtered %>%filter(SPECIES_NAME !="NA") %>%ggplot(aes(x = PVbar, y = SPECIES_NAME, fill = analysis_group )) +geom_col(position =position_dodge(width =0.8), width =0.8) +scale_fill_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM")) +geom_errorbar(aes(xmin = PV_LCI, xmax = PV_UCI),position =position_dodge(width =0.8), width =0.1) +facet_wrap(~analysis_group) +labs(x ="Proportion of Colonies Bleached", y ="Coral Species", fill ="") +scale_x_continuous(expand =expansion(mult =c(0, 0.1))) +theme_Publication(base_size =10) +coord_cartesian(clip ="off") +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')"))) +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) #+# ggtitle("2022 Estimates")print(plt_bleach)
Figure 4. Estimated Observed Bleaching Frequency in 2022 using Ratio Estimaters.
Figure 11. Mean scleractinan and macroalgal cover at each of the eight M:IR restoration sites in 2022 and 2024.
12References
Ault, J. S., Smith, S. G., Luo, J., Grove, L. J., Johnson, M. W., and Blondeau, J. (2021). Refinement of the southern Florida Reef Tract benthic habitat map with habitat use patterns of reef fish species. (NCEI Accession 0224176). NOAA National Centers for Environmental Information. Dataset. https://www.ncei.noaa.gov/archive/accession/0224176 NOAA Coral Reef Conservation Program. (2022b).
National Coral Reef Monitoring Program (NCRMP) benthic community assessment survey field protocols for U.S. Atlantic: Florida, Flower Garden Banks, Puerto Rico, and U.S. Virgin Islands–2022. NOAA Coral Reef Conservation Program. https://doi.org/0.25923/0708-8333
NOAA Coral Reef Conservation Program. (2022c). National Coral Reef Monitoring Program (NCRMP) coral demographics survey field protocols for U.S. Atlantic: Florida, Flower Garden Banks, Puerto Rico, U.S. Virgin Islands. 2022. NOAA Coral Reef Conservation Program. https://doi.org/10.25923/9a1r-m911
NOAA National Marine Fisheries Service. (2014). Final rule. Endangered and threatened wildlife and plants: Final listing determinations on proposal to list 66 reef-building coral species and to reclassify elkhorn and staghorn corals. Federal Register, 79(175), 53851–54123.
insert fish tech memo referenced earlier
also missing some of the field protocols?
Source Code
---title: "Mission: Iconic Reefs and National Coral Reef Monitoring Program Benthic Analysis"author: - Nicole Krampitz, Julia Mateski, and Dione Swansonformat: html: theme: cosmo toc: true toc-depth: 2 number-sections: true code-fold: true code-tools: true fig-cap-location: bottom fig-align: center self-contained: true title-block-banner: true title-block-style: default include-before-body: logos.html pdf: documentclass: article fig-cap-location: bottom includes: in_header: custom_header.texeditor: visualexecute: freeze: auto echo: true warning: false message: false---The [Mission: Iconic Reefs](https://www.fisheries.noaa.gov/southeast/habitat-conservation/restoring-seven-iconic-reefs-mission-recover-coral-reefs-florida-keys) (M:IR) project is a decades-long ambitious effort to restore seven key coral reef areas in the Florida Keys National Marine Sanctuary (FKNMS) via coral propagation and transplantation. Restoration is being carried out in planned phases along with biennial monitoring to provide a quantitative measure of restoration effects over time. The primary goal of this monitoring is to compare fish populations, coral populations, and benthic community metrics within M:IR restoration areas to those reefs in the broader Florida Keys in partnership with the National Coral Reef Monitoring Program (NCRMP). Currently, two rounds of surveying have been completed (in 2022 and 2024) to establish baseline conditions. This report focuses on coral populations and benthic community metrics; a separate report can be found for fish population assessments.{fig-align="center"}```{r libraries, include = FALSE}# LIBRARIES library(ggplot2)library(dplyr)library(tidyr)library(cowplot)library(grid)library(patchwork)library(ggthemes)library(extrafont)library(grid)library(ggthemes)library(extrafont)library(plotly)library(tidyverse)library(ncrmp.benthics.analysis)library(ggplot2)library(cowplot)library(gridExtra)library(egg)library(mgcv)# source("R Scripts/total_dis_code.R")source("../Project/R Scripts/MIR_make_size_bins.R")source("../Project/R Scripts/theme_publication.R")source("../Project/R Scripts/QuadPanel.R")# source("R Scripts/bleaching_estimates.R")# source("R Scripts/total_bleach_code.R")source("../Project/R Scripts/dis_ble_prev_ratio_est.R")``````{r MIR species, echo = FALSE}MIR_species <-c( "ACR CERV", "ACR PALM", "COL NATA", "DEN CYLI","DIC STOK", "DIP LABY", "EUS_ AST", "MEA MEAN","PSE CLIV", "PSE STRI", "MON CAVE" )```Corals and benthic communities were monitored using two different surveys: a Benthic Community Assessment survey and a Coral Demographics survey (NOAA CRCP, 2022b, 2022c). The Benthic Community Assessment survey includes: 1) benthic cover (%) estimates along a 15-m transect with a line point intercept method, 2) presence/absence of Endangered Species Act (ESA)-listed coral species (NOAA National Marine Fisheries Service, 2014), 3) abundance of key macroinvertebrates, and 4) reef rugosity measurements within a 15 m x 2 m belt-transect area (NOAA CRCP, 2022b). At the same site, coral demographics were surveyed within a 10 m x 1 m belt-transect area (NOAA CRCP, 2022c). NCRMP coral demographic survey data was combined with complementarily allocated survey data from Florida Reef Resiliency Program's Disturbance Response Monitoring (DRM). In all Coral Demographics surveys, all live coral colonies ≧ 4 cm were counted, identified to species, measured to the nearest centimeter (length, width, height), and estimates were made of the proportion per colony of any present mortality (recent or old), disease (present, slow, fast), and/or bleaching (total, partial, paling). Only live coral colonies were included in the survey; dead colonies with 100% mortality were not surveyed (e.g., colonies killed by coral disease). Juvenile corals (\< 4 cm) were reported for species richness only and were not included in counts, size measurements, or estimates of condition.A majority of the reef habitats within the seven M:IR areas ranged from 0-12 meters depth. For comparison, survey data from the NCRMP were restricted to the same depth range. The tables and figures below include: Sampling effort by strata and survey year and species-specific estimates of colony density, mean size, partial mortality, size frequency, and prevalence of bleaching and disease. Statistical comparisons were conducted between M:IR and NCRMP estimates for each survey year and between years for M:IR and NCRMP.## Benthic Cover Sites```{r prepare data for benthic cover table, include = FALSE}##Let's just start with MIR/NCRMP only (benthic cover)NCRMP_MIR <-read_csv("../Project/data/NCRMP_MIR_cora_2022_24_psu_grps.csv") %>%group_by(YEAR, strat_cora, analysis_group) %>%summarise(count =n()) %>%filter(analysis_group !="NCRMP_NA") %>%rename(STRAT = strat_cora,PROT = analysis_group) %>%mutate(description =case_when( STRAT =="CFK01"~"Inshore reef, all relief types and depths", STRAT =="CFK02"~"Mid-channel patch reef, all relief types and depths", STRAT =="CFK03"~"Offshore patch reef, all relief types and depths", STRAT =="CFK04"~"Forereef, low relief, shallow (0-6 m)", STRAT =="CFK05"~"Forereef, high relief, shallow (0-6 m)", STRAT =="CFK06"~"Forereef, low relief, mid-shallow (6-12 m)", STRAT =="CFK07"~"Forereef, high relief, mid-shallow (6-12 m)"))table <- NCRMP_MIR %>%pivot_wider(id_cols = STRAT:description, names_from = YEAR, values_from = count) %>%mutate(`Study area`=case_when( PROT =="MIR_GRP"~"Inside (M:IR)", PROT =="NCRMP_GRP"~"Outside (NCRMP)" )) %>%select(`Study area`, STRAT, description, `2022`, `2024`) %>%arrange(`Study area`, STRAT)#conditional statement for rendering in both HTML and PDFif (knitr::is_html_output()) { DT::datatable(table,class ="cell-border stripe",rownames =FALSE,colnames =c("Study Area", "Strata Name", "Strata Description", "2022 Sample Number", "2024 Sample Number"),caption ="Table 1. Number of benthic cover sites sampled inside and outside M:IR areas in each stratum.",options =list(columnDefs =list(list(className ='dt-center', targets ="_all")),info =FALSE,paging =FALSE,searching =FALSE ) )}name <-c("Study Area", "Strata Name", "Strat Description", "2022 Sample Number", "2024 Sample Number")invisible(table)``````{r create benthic cover table, echo = FALSE}sjPlot::tab_df( table,title ="<div style='text-align:center'>Table 1. Number of benthic cover sites sampled inside and outside M:IR areas in each stratum.</div>",escape =FALSE,show.footnote =TRUE,alternate.rows =TRUE,col.header = name)```## Coral Demographic Sites```{r create coral demo table data, include = FALSE}###Demographics (including DRM)DRM <-read_csv("../Project/data/DRM_cora_2022_24_psu_grps.csv") %>%group_by(YEAR, strat_cora, analysis_group) %>%summarise(count =n()) %>%filter(analysis_group !="NCRMP_NA") %>%rename(STRAT = strat_cora,PROT = analysis_group) %>%mutate(description =case_when( STRAT =="CFK01"~"Inshore reef, all relief types and depths", STRAT =="CFK02"~"Mid-channel patch reef, all relief types and depths", STRAT =="CFK03"~"Offshore patch reef, all relief types and depths", STRAT =="CFK04"~"Forereef, low relief, shallow (0-6 m)", STRAT =="CFK05"~"Forereef, high relief, shallow (0-6 m)", STRAT =="CFK06"~"Forereef, low relief, mid-shallow (6-12 m)", STRAT =="CFK07"~"Forereef, high relief, mid-shallow (6-12 m)")) %>%rbind(., NCRMP_MIR) %>%group_by(STRAT, PROT, YEAR, description) %>%summarise(count =sum(count)) %>%ungroup()table_2 <- DRM %>%pivot_wider(id_cols = STRAT:description, names_from = YEAR, values_from = count) %>%mutate(`Study area`=case_when( PROT =="MIR_GRP"~"Inside (M:IR)", PROT =="NCRMP_GRP"~"Outside (NCRMP + DRM)" )) %>%select(`Study area`, STRAT, description, `2022`, `2024`) %>%arrange(`Study area`, STRAT)if (knitr::is_html_output()) { DT::datatable(table_2,class ="cell-border stripe",rownames =FALSE,colnames =c("Study Area", "Strata Name", "Strata Description", "2022 Sample Number", "2024 Sample Number"),caption ="Table 2. The number of coral demographic sites sampled inside and outside M:IR areas in each stratum (includes DRM data).",options =list(columnDefs =list(list(className ='dt-center', targets ="_all")),info =FALSE,paging =FALSE,searching =FALSE ) )}invisible(table2)``````{r print coral demo table, echo = FALSE}sjPlot::tab_df( table_2,title ="<div style='text-align:center'>The number of coral demographic sites sampled inside and outside M:IR areas in each stratum (includes DRM data).</div>",escape =FALSE,show.footnote =TRUE,alternate.rows =TRUE,col.header = name)```## Most Common and Focal M:IR SpeciesM:IR selected 10 focal coral species for comparison to NCRMP: *Acropora palmata*, *Acropora cervicornis*, *Colpophyllia natans*, *Dendrogyra cylindrus*, *Dichocoenia stokesii*, *Diploria labyrinthiformis*, *Meandrina meandrites*, *Montastraea cavernosa*, *Pseudodiploria clivosa*, and *Pseudodiploria strigosa*. The following table summarizes the number of observations across all stratum and survey years of each focal species and identifies the most abundant species encountered.```{r make data for top species, include = FALSE}##Everything calculated for density is done so by region/year, so maybe just do total colonies observed?df <-read.csv( "../Project/data/FK2024_NCRMP_DRM_MIR_corsz_AR_NK.csv") %>%filter(N >0, analysis_group !="NCRMP_NA") %>%group_by(SPECIES_CD) %>%summarise(observed =n()) %>%arrange(desc(observed))##Top 15 speciestop <- df %>%slice(1:15)##MIR Speciestarget_species <-c("ACR PALM", "ACR CERV", "COL NATA", "DEN CYLI","DIC STOK", "DIP LABY", "EUS_ AST", "MEA MEAN","PSE CLIV", "PSE STRI", "MON CAVE")MIR <- df %>%filter( SPECIES_CD %in% target_species)##Togethertable <-full_join(MIR, top)##Add names from origial DRM datanames <-read_csv("../Project/data/DRM_FLK_2014_2024_2stage_coral_demographics.csv") %>%select(SPECIES_CD, SPECIES_NAME) %>%unique()final <-left_join(table, names) %>%select(SPECIES_NAME, SPECIES_CD, observed) %>%arrange(desc(observed)) %>%mutate(SPECIES_NAME =ifelse(`SPECIES_CD`%in% target_species,paste0("*", "<i>", SPECIES_NAME, "</i>"),paste0("<i>", SPECIES_NAME, "</i>") ))``````{r create top species table, echo = FALSE}sjPlot::tab_df( final,title ="<div style='text-align:center'>Table 3. Most Observed Species and Focal M:IR Species</div>",alternate.rows =TRUE,show.footnote =TRUE,footnote ="* indicates M:IR focal species",col.header =c("Species", "Species Code", "Number of Colonies Observed"))```## Benthic Cover CompositionTemporal trends in benthic cover of functional groups such as coral and macroalgae cover provide insight .....```{r fig 1: benthic cover data, fig.width=12, fig.asp=0.6, echo = FALSE}#get cover categoriescat_codes <-read_csv("../Project/data/bcov_cat_codes.csv") %>% dplyr::rename(cover_group = CODE)#load and clean cover data (MIR and NCRMP, no DRM)cvr <-read_csv("../Project/data/fk2022_24_NCRMP_MIR_bcov_catcd_dom_NK.csv")%>% dplyr::rename(cover_group = COVER_CAT_CD,REGION = analysis_group,avCvr = wavp,SE = se_wp,n_sites = n ) %>%left_join(cat_codes)``````{r fig_benthic_cover_data (OG), fig.cap="Figure 2. Hard coral and macroalgae cover estimates inside and outside M:IR areas for 2022 and 2024. Significant difference in cover estimates in each of these areas was indicated by (*).", fig.width=12, fig.asp=0.9, echo=FALSE}wanted_cover_cats <-c("HCORA" , "MACAL")#Formatting Data for Combined Macroalgal/Hard Coral plotcvr_analysis <- cvr %>%group_by(REGION, COV_CAT_A, YEAR) %>%filter(COV_CAT_A %in% wanted_cover_cats) %>%summarise(avCvr =sum(avCvr),SE =sqrt(sum(SE^2)) )#change names --> more readablenew_dat <- cvr_analysis %>%mutate(COV_CAT_A =recode(COV_CAT_A, "HCORA"="Hard Coral", "MACAL"="Macroalgae","RAMIC"="Ramicrusta","TURFA"="Turf Algae"))dodge_width <-0.06cover_plot <- new_dat %>%ggplot(aes(x =as.integer(YEAR), y = avCvr *100, group =interaction(COV_CAT_A, REGION), color = REGION)) +geom_point(size =2, position =position_dodge(width =0.06)) +geom_line(size =1, position =position_dodge(width =0.06)) +geom_errorbar(aes(ymin = avCvr*100- SE*100, ymax = avCvr*100+ SE*100),width =0.1,position =position_dodge(width =0.06)) +scale_color_manual(values =c("MIR_GRP"="#0072B2", "NCRMP_GRP"="#D55E00"),labels =c("MIR", "NCRMP"),name ="") +labs(x ="Year", y ="Cover (%)", title ="" ) +facet_wrap(~ COV_CAT_A) +scale_x_continuous(breaks =c(2022, 2024)) +#scale_y_continuous(, labels = scales::percent_format(accuracy = 2) ) +theme_Publication(base_size =20) +theme(strip.text =element_text(face ="bold", size =18),legend.position ="bottom",legend.direction ="horizontal",legend.key.size =unit(1.2, "cm"),legend.margin =margin(0, 0, 0, 0, "cm"),legend.text =element_text(size =18),legend.background =element_blank(),legend.title =element_blank() ) +guides(color =guide_legend(override.aes =list(size =4)))cover_plot```## Species Specific PlotsInsert more text here. Sentence about surveys designed to produce population estimates of coral species. Metrics for status, trends and restoration effects(?) - density, partial mortality, mean colony size, colony size frequency, and colony size partial mortality. Only focal M:IR species are reported belowThe following figures for these metrics are grouped by each focal species. Significant statistical differences are indicated for differences between survey years and between areas (MIR vs. NCRMP) for density, old mortality, and mean colony size.```{r prep density data, fig.width=12, fig.asp=0.6, echo = FALSE}# Read in clean dens dataden <-read_csv("../Project/data/fk2022_24_NCRMP_MIR_corabd_dom_NK.csv") %>%rename(avDen = wavdns,SE = se_wdns,CV_perc = wcv_dns,n_sites = n)#load full species namenames <-read_csv("../Project/data/NCRMP_FKEYS2022_Benthic_Data02_CoralDemographics.csv") %>%select(SPECIES_CD, SPECIES_NAME)#Join w species namesden <- den %>%left_join(names, by ="SPECIES_CD")``````{r find top species, echo = FALSE}# Load data to find top speciesAR_ready_demo <-read_csv("../Project/data/FK2024_NCRMP_DRM_MIR_corsz_AR_NK.csv")df <- AR_ready_demo %>%filter(N ==1) %>%group_by(SPECIES_CD) %>%summarise(total =n(), .groups ="drop") %>%arrange(desc(total)) %>%#filter(SPECIES_CD %in% codes) %>%slice(1:10)topspecies <- df$SPECIES_CD# Combine top species with MIR_speciestarget_species <-unique(c(topspecies, MIR_species))``````{r prep data, echo = FALSE}tmp <-quad_panel_MIR(target_species)# Prepare Density Dataa <- tmp$AR_density %>%select(YEAR, SPECIES_CD, wavdns, se_wdns, analysis_group) %>%rename(avDen = wavdns, SE_avDen = se_wdns)# Prepare old mort datab <- tmp$AR_mortality %>%filter(MORT_TYPE =="Old") %>%select(YEAR, SPECIES_CD, avMort, SE, analysis_group) %>%rename(avMortOld = avMort, SE_avMortOld = SE)# old_mortality_ready_for_stat_testing <- b %>%# mutate(UCI = avMortOld + SE_avMortOld,# LCI = avMortOld - SE_avMortOld)# # view(old_mortality_ready_for_stat_testing)# # readr::write_csv(old_mortality_ready_for_stat_testing, "old_mortality_ready_for_stat_testing.csv")# # dens_ready_for_stat_testing <- a%>%# mutate(UCI = avDen + SE_avDen,# LCI = avDen - SE_avDen)# # # readr::write_csv(dens_ready_for_stat_testing, "dens_ready_for_stat_testing.csv")# # # view(dens_ready_for_stat_testing)# Prepare size data# c <- tmp$AR_col_size %>%# mutate(SE_maxdiam = sqrt(var_maxdiam)) %>%# rename(avMaxdiam = avg_maxdiam) %>%# select(REGION, YEAR, SPECIES_CD, avMaxdiam, SE_maxdiam, analysis_group)#RATIO ESTIMATIONratio_est_2022 <-read_csv("../Project/data/fk2022_NCRMP_MIR_sppLbar_dom.csv")ratio_est_2024 <-read_csv("../Project/data/fk2024_NCRMP_MIR_sppLbar_domv2.csv")c <-bind_rows(ratio_est_2022, ratio_est_2024) %>%rename(avMaxdiam = Lbar,SE_maxdiam = SE_L)# Prep make size binstmp <-MIR_make_size_bins(years =c(2022, 2024),analyzed_species = MIR_species)#gather and clean domain Estdomain_estimates <- tmp$length_freq_domain_est %>% dplyr::mutate(YEAR =as.factor(YEAR)) %>% dplyr::ungroup()#gather and clean length demosdemos <- tmp$length_demos %>% dplyr::mutate(YEAR =as.factor(YEAR)) %>% dplyr::ungroup()#get domain mortality datadomain_mort <- tmp$domain_mort_spp# write_csv(a, "../Project/denisty_data.csv")# write_csv(b, "../Project/old_mort.csv")# write_csv(c, "../Project/max_diam.csv")``````{r create_species_plots function, fig.width=9, fig.asp=1.2, echo = FALSE}create_species_plots <-function(species) { den_filtered <- a %>%filter(SPECIES_CD == species) b_filtered <- b %>%filter(SPECIES_CD == species) c_filtered <- c %>%filter(SPECIES_CD == species)if (nrow(den_filtered) ==0||nrow(b_filtered) ==0||nrow(c_filtered) ==0) {return(NULL) }dodge_width <-0.05 plt1 <- den_filtered %>%ggplot(aes(x = YEAR, y = avDen, group = analysis_group, color = analysis_group)) +geom_point(position =position_dodge(dodge_width)) +geom_line(position =position_dodge(dodge_width)) +geom_errorbar(aes(ymin = avDen - SE_avDen, ymax = avDen + SE_avDen), width =0.1, position =position_dodge(dodge_width)) +labs(y ="Density (col/m2)", x ="Sample Year", title ="Coral Density") +theme_Publication(base_size =10) +theme(strip.text =element_text(face ="italic"))+theme(legend.position ="none") +scale_x_continuous(breaks =c(2022, 2024)) +scale_color_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "Outside"), name ="") +scale_linetype_manual(values =c("solid", "dashed"), guide ="none") plt2 <- b_filtered %>%ggplot(aes(x = YEAR, y = avMortOld, group = analysis_group, color = analysis_group)) +geom_point(position =position_dodge(dodge_width)) +geom_line(position =position_dodge(dodge_width)) +geom_errorbar(aes(ymin = avMortOld - SE_avMortOld, ymax = avMortOld + SE_avMortOld), width =0.1, position =position_dodge(dodge_width)) +labs(y ="Old Mortality (%)", x ="Sample Year", title ="Old Mortality") +theme_Publication(base_size =10) +theme(strip.text =element_text(face ="italic"))+theme(legend.position ="none") +scale_x_continuous(breaks =c(2022, 2024)) +scale_color_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "Outside"), name ="") +scale_linetype_manual(values =c("solid", "dashed"), guide ="none") plt3 <- c_filtered %>%ggplot(aes(x = YEAR, y = avMaxdiam, group = analysis_group, color = analysis_group)) +geom_point(position =position_dodge(dodge_width)) +geom_line(position =position_dodge(dodge_width)) +geom_errorbar(aes(ymin = avMaxdiam - SE_maxdiam, ymax = avMaxdiam + SE_maxdiam), width =0.1, position =position_dodge(dodge_width)) +labs(y ="Mean Max Diameter (cm)", x ="Sample Year", title ="Colony Size") +theme_Publication(base_size =10) +theme(strip.text =element_text(face ="italic"))+theme(legend.position ="none") +scale_x_continuous(breaks =c(2022, 2024)) +scale_color_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "Outside"), name ="") +scale_linetype_manual(values =c("solid", "dashed"), guide ="none")#name = "Length (cm)" domain_sub =subset(domain_estimates, SPECIES_CD == species) demos_sub =subset(demos, SPECIES_CD == species) mort_sub = domain_mort %>% dplyr::filter(SPECIES_CD == species) domain_sub <- domain_sub %>%# add 0s in for species not observed tidyr::expand(., REGION, analysis_group, SPECIES_CD, YEAR, bin_num) %>%#filter(YEAR %in% years) %>% #Filter back to years analyzed only# connect back to demo_data to fill in with NAs dplyr::full_join(., domain_sub) %>%# make a presence/absence column dplyr::mutate(length_freq_domain =ifelse(is.na(length_freq_domain), 0, length_freq_domain)) %>%# add in mortality data dplyr::full_join(., mort_sub) n_bins =max(demos_sub$n_bins) text_size =14 angle =45 hjust = dplyr::if_else(angle ==45, 1, 0.5) min =min(demos_sub$min) bin_width =min(demos_sub$bin_width) small = dplyr::if_else(n_bins >4, 0, 1) num_vec =seq_len(max(domain_sub$bin_num)) lab_vec <-c("4- 10", " 11-15", " 16-20", " 21-25", " 26-30", " 31-35", " 36-45", " 46-65", " 66-85", " 86-105", "106+") species_name <- names %>%filter(SPECIES_CD == species) %>%distinct(SPECIES_NAME) %>%pull(SPECIES_NAME) plt4 <-ggplot(data = domain_sub, aes(x =as.integer(bin_num), y = length_freq_domain, fill = analysis_group)) +geom_bar(stat ="identity", position ="dodge2", width =0.9, color ="black", size =0.5) +geom_point(aes(y = oldmort_domain, color = analysis_group), size =2) +geom_line(aes(y = oldmort_domain, color = analysis_group), size =2, alpha =0.5) +facet_wrap(~YEAR) +labs(y ="Frequency (Size Class & Mortality)", x ="Length (cm)") +scale_x_continuous(breaks =seq_along(lab_vec), labels = lab_vec) +scale_fill_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM")) +scale_color_manual(values =c("#0072B2", "#D55E00"), guide ="none") +theme_Publication(base_size =10) +theme(axis.text.x =element_text(size = text_size, angle = angle, hjust = hjust),legend.title =element_blank(),strip.text =element_text(face ="italic"))#what goes between the three plots and the size freq/mort plot middle_annotation <-ggplot() +geom_text(aes(x =0.5, y =0.5, label ="Size Frequency Distributions"), size =5, fontface ="bold") +theme_void() +theme(plot.margin =margin(0, 0, 0, 0))library(magick)library(png)library(jpeg)species_images <-list("Acropora cervicornis"=list(path ="../Project/coral_image_files/staghorn.jpg", type ="jpg"),"Colpophyllia natans"=list(path ="../Project/coral_image_files/col_nata.jpg", type ="jpg"),"Dichocoenia stokesii"=list(path ="../Project/coral_image_files/dic_stok.jpg", type ="jpg"),"Diploria labyrinthiformis"=list(path ="../Project/coral_image_files/dip_laby.jpg", type ="jpg"),"Meandrina meandrites"=list(path ="../Project/coral_image_files/mea_mean.jpg", type ="jpg"),"Pseudodiploria clivosa"=list(path ="../Project/coral_image_files/pse_cliv.png", type ="png"),"Pseudodiploria strigosa"=list(path ="../Project/coral_image_files/pse_stri.png", type ="png"),"Montastraea cavernosa"=list(path ="../Project/coral_image_files/mon_cave.jpg", type ="jpg"),"Acropora palmata"=list(path ="../Project/coral_image_files/acr_palm.png", type ="png"))get_species_image_plot <-function(species_name) { info <- species_images[[species_name]]if (!is.null(info)) { img <-switch(info$type,png = png::readPNG(info$path),jpg = jpeg::readJPEG(info$path)) cowplot::ggdraw() + cowplot::draw_image(img) } else {ggplot() +theme_void() }}image_plot <-get_species_image_plot(species_name)final_plot <- (image_plot/ (plt1 + plt2 + plt3) / middle_annotation / plt4) +plot_layout(heights =c(1, 1, 0.1, 1.4)) +plot_annotation(title =paste0("<b><i>", species_name, "</i></b>"),subtitle ="Colony density, mortality, size, and size class distribution (2022 vs. 2024)",theme =theme(plot.title = ggtext::element_markdown(hjust =0.5, size =18),plot.subtitle =element_text(hjust =0.5, size =14) ))return(final_plot)}plots_list <-map(MIR_species, create_species_plots)names(plots_list) <- MIR_specieslst_clean <-compact(plots_list)```<!-- Tabs for HTML output -->```{r coral-tabyss, echo=FALSE, fig.cap="Figures 3a-3i. Coral density, old mortality, colony size, and size frequency distribution for focal M:IR species across sample years (2022 and 2024) and survey types (MIR and NCRMP + DRM). Significant difference in cover estimates in each of these areas was indicated by (*).", results='asis', fig.width=9, fig.asp=1.2}cat("::: {.panel-tabset}\n\n") # open tabset containerwalk(seq_along(lst_clean), function(i) { plot <- lst_clean[[i]] species_code <-names(lst_clean)[[i]] species_name <- names %>%filter(SPECIES_CD == species_code) %>%distinct(SPECIES_NAME) %>%pull(SPECIES_NAME)cat("### <em>", species_name, "</em> {.tab-pane}\n\n")print(plot)})cat("\n:::\n") # close tabset container```## Bleaching Estimates### 2022```{r bleach 2022, fig.cap = "Figure 4. Estimated Observed Bleaching Frequency in 2022 using Ratio Estimaters.", fig.width=9, fig.asp=1.2}# Set path to data filesdata_2022_path <-"data/FK2022_NCRMP_DRM_MIR_corsz_ARallv2.csv"MIR_species <-c("ACR PALM", "ACR CERV", "COL NATA", "DEN CYLI", "DIC STOK", "DIP LABY", "EUS FAST", "MEA MEAN", "PSE CLIV", "PSE STRI", "MON CAVE")#Script works for the actual value but CI are not exact# tmp <- disease_bleach_prevalence_ratio_est(data_2022_path, 2022) %>%# filter(PV_TYPE == "Bleach_All") %>%# left_join(., names)names_clean <- names %>%select(SPECIES_CD, SPECIES_NAME) %>%distinct(SPECIES_CD, .keep_all =TRUE)tmp_ble_2022 <-read_csv("../Project/data/fk2022_NCRMP_MIR_sppPVbar_Ball_dom.csv") %>%left_join(., names_clean, by ="SPECIES_CD")top_species <- tmp_ble_2022 %>%group_by(SPECIES_CD) %>%summarise(mean_pv =mean(PVbar, na.rm =TRUE)) %>%arrange(desc(mean_pv)) %>%slice_head(n =10) %>%pull(SPECIES_CD)tmp_filtered <- tmp_ble_2022 %>%filter(SPECIES_CD %in%union(top_species, MIR_species)) ##Add a * for those MIR speciestmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0("*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME)))#Factor re-order for aesthetics tmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(PVbar), 0, PVbar), .desc =FALSE)) %>%mutate(analysis_group =recode(analysis_group,"MIR_GRP"="MIR","NCRMP_GRP"="NCRMP + DRM"))plt_bleach <- tmp_filtered %>%filter(SPECIES_NAME !="NA") %>%ggplot(aes(x = PVbar, y = SPECIES_NAME, fill = analysis_group )) +geom_col(position =position_dodge(width =0.8), width =0.8) +scale_fill_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM")) +geom_errorbar(aes(xmin = PV_LCI, xmax = PV_UCI),position =position_dodge(width =0.8), width =0.1) +facet_wrap(~analysis_group) +labs(x ="Proportion of Colonies Bleached", y ="Coral Species", fill ="") +scale_x_continuous(expand =expansion(mult =c(0, 0.1))) +theme_Publication(base_size =10) +coord_cartesian(clip ="off") +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')"))) +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) #+# ggtitle("2022 Estimates")print(plt_bleach)```### 2024```{r bleach 2024, fig.cap = "Figure 5. Estimated Observed Bleaching Frequency in 2024 using Ratio Estimaters", fig.width=9, fig.asp=1.2}# Set path to data filesdata_2022_path <-"data/FK2022_NCRMP_DRM_MIR_corsz_ARallv2.csv"MIR_species <-c("ACR PALM", "ACR CERV", "COL NATA", "DEN CYLI", "DIC STOK", "DIP LABY", "EUS FAST", "MEA MEAN", "PSE CLIV", "PSE STRI", "MON CAVE")#same as section above# tmp <- disease_bleach_prevalence_ratio_est(data_2022_path, 2022) %>%# filter(PV_TYPE == "Bleach_All") %>%# left_join(., names)names_clean <- names %>%select(SPECIES_CD, SPECIES_NAME) %>%distinct(SPECIES_CD, .keep_all =TRUE)tmp <-read_csv("../Project/data/fk2024_NCRMP_MIR_sppPVbar_Ball_dom.csv") %>%left_join(names_clean, by ="SPECIES_CD")top_species <- tmp %>%group_by(SPECIES_CD) %>%summarise(mean_pv =mean(PVbar, na.rm =TRUE)) %>%arrange(desc(mean_pv)) %>%slice_head(n =10) %>%pull(SPECIES_CD)tmp_filtered <- tmp %>%filter(SPECIES_CD %in%union(top_species, MIR_species)) ##Add a * for those MIR speciestmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0("*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME)))#Factor re-order for aesthetics tmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(PVbar), 0, PVbar), .desc =FALSE)) %>%mutate(analysis_group =recode(analysis_group,"MIR_GRP"="MIR","NCRMP_GRP"="NCRMP + DRM"))plt_bleach <- tmp_filtered %>%filter(SPECIES_NAME !="NA") %>%ggplot(aes(x = PVbar, y = SPECIES_NAME, fill = analysis_group)) +geom_col(position =position_dodge(width =0.8), width =0.8) +geom_errorbar(aes(xmin = PV_LCI, xmax = PV_UCI),position =position_dodge(width =0.8), width =0.1) +facet_wrap(~analysis_group) +labs(x ="Proportion of Colonies Bleached", y ="Coral Species", fill ="") +scale_x_continuous(expand =expansion(mult =c(0, 0.1))) +theme_Publication(base_size =10) +coord_cartesian(clip ="off") +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')"))) +scale_fill_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM")) +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) #+#ggtitle("2024 Estimates")print(plt_bleach)```## Disease Estimates### 2022```{r disease 2024, fig.cap = "Figure 6 . Estimated Observed Disease Frequency in 2022 using Ratio Estimaters.", fig.width=9, fig.asp=1.2}# Set path to data filesdata_2022_path <-"../Project/data/FK2022_NCRMP_DRM_MIR_corsz_ARallv2.csv"MIR_species <-c("ACR PALM", "ACR CERV", "COL NATA", "DEN CYLI", "DIC STOK", "DIP LABY", "EUS FAST", "MEA MEAN", "PSE CLIV", "PSE STRI", "MON CAVE")# tmp <- disease_bleach_prevalence_ratio_est(data_2022_path, 2022) %>%# filter(PV_TYPE == "Bleach_All") %>%# left_join(., names)names_clean <- names %>%select(SPECIES_CD, SPECIES_NAME) %>%distinct(SPECIES_CD, .keep_all =TRUE)tmp_dis_2022 <-read_csv("../Project/data/fk2022_NCRMP_MIR_sppPVbar_Dall_dom.csv") %>%left_join(names_clean, by ="SPECIES_CD")top_species <- tmp_dis_2022 %>%group_by(SPECIES_CD) %>%summarise(mean_pv =mean(PVbar, na.rm =TRUE)) %>%arrange(desc(mean_pv)) %>%slice_head(n =10) %>%pull(SPECIES_CD)tmp_filtered <- tmp_dis_2022 %>%filter(SPECIES_CD %in%union(top_species, MIR_species)) ##Add a * for those MIR speciestmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0( "*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME)))#Factor re-order for aesthetics tmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(PVbar), 0, PVbar), .desc =FALSE)) %>%mutate(analysis_group =recode(analysis_group,"MIR_GRP"="MIR","NCRMP_GRP"="NCRMP + DRM"))plt_disease <- tmp_filtered %>%filter(SPECIES_NAME !="NA") %>%ggplot(aes(x = PVbar, y = SPECIES_NAME, fill = analysis_group)) +geom_col(position =position_dodge(width =0.8), width =0.8) +geom_errorbar(aes(xmin =pmax(0, PV_LCI), xmax = PV_UCI),width =0.15 ) +facet_wrap(~analysis_group) +labs(x ="Proportion of Colonies Bleached", y ="Coral Species", fill ="") +scale_x_continuous(expand =expansion(mult =c(0, 0.1))) +theme_Publication(base_size =10) +coord_cartesian(clip ="off") +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')"))) +scale_fill_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM")) +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) #+#ggtitle("2022 Estimates")print(plt_disease)```### 2024```{r, fig.cap = "Figure 7 . Estimated Observed Disease Frequency in 2024 using Ratio Estimaters.", fig.width=9, fig.asp=1.2}# Set path to data filesdata_2024_path <-"../Project/data/FK2022_NCRMP_DRM_MIR_corsz_ARallv2.csv"MIR_species <-c("ACR PALM", "ACR CERV", "COL NATA", "DEN CYLI", "DIC STOK", "DIP LABY", "EUS FAST", "MEA MEAN", "PSE CLIV", "PSE STRI", "MON CAVE")# tmp <- disease_bleach_prevalence_ratio_est(data_2022_path, 2022) %>%# filter(PV_TYPE == "Bleach_All") %>%# left_join(., names)names_clean <- names %>%select(SPECIES_CD, SPECIES_NAME) %>%distinct(SPECIES_CD, .keep_all =TRUE)tmp_dis_2024 <-read_csv("../Project/data/fk2024_NCRMP_MIR_sppPVbar_Dall_dom.csv") %>%left_join(names_clean, by ="SPECIES_CD")top_species <- tmp_dis_2024 %>%group_by(SPECIES_CD) %>%summarise(mean_pv =mean(PVbar, na.rm =TRUE)) %>%arrange(desc(mean_pv)) %>%slice_head(n =10) %>%pull(SPECIES_CD)tmp_filtered <- tmp_dis_2024 %>%filter(SPECIES_CD %in%union(top_species, MIR_species)) ##Add a * for those MIR speciestmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0( "*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME)))#Factor re-order for aesthetics tmp_filtered <- tmp_filtered %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(PVbar), 0, PVbar), .desc =FALSE)) %>%mutate(analysis_group =recode(analysis_group,"MIR_GRP"="MIR","NCRMP_GRP"="NCRMP + DRM"))plt_dis <- tmp_filtered %>%filter(SPECIES_NAME !="NA") %>%ggplot(aes(x = PVbar, y = SPECIES_NAME, fill = analysis_group)) +geom_col(position =position_dodge(width =0.8), width =0.8) +geom_errorbar(aes(xmin =pmax(0, PV_LCI), xmax = PV_UCI),width =0.15) +facet_wrap(~analysis_group) +labs(x ="Proportion of Colonies Bleached", y ="Coral Species", fill ="") +scale_x_continuous(expand =expansion(mult =c(0, 0.1))) +theme_Publication(base_size =10) +coord_cartesian(clip ="off") +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')"))) +scale_fill_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM")) +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) #+# ggtitle("2024 Disease Estimates")print(plt_dis)```## Overall Density Comparision```{r overall Density, fig.cap = "Figure 8. Caption needed here!", fig.width=9, fig.asp=1.2, echo = FALSE}###Adding species names and starring MIR speciesa <-left_join(a, names %>%distinct(), by ="SPECIES_CD") %>% dplyr::mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0("*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME))) #Factor re-order for aesthetics a <- a %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(avDen), 0, avDen), .desc =FALSE)) plt1 <- a %>%ggplot(aes(x = avDen, y = SPECIES_NAME, group =interaction(SPECIES_CD, analysis_group), color = analysis_group)) +geom_point( position =position_dodge(width =0.3)) +geom_errorbar(aes(xmin = avDen - SE_avDen, xmax = avDen + SE_avDen), width =0.1, position =position_dodge(width =0.3)) +labs(y ="Species", x ="Density (col/m2)") +theme_Publication(base_size =10) +facet_grid(~YEAR) +scale_x_continuous(expand =expansion(mult =c(0, 0))) +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')")))+theme(strip.text =element_text(face ="italic"))+scale_color_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM"), name ="") +scale_linetype_manual(values =c("solid", "dashed"), guide ="none") +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) print(plt1)```## Overall Old Mortality Comparision```{r overall Old_Mort, fig.cap = "Figure 9. Caption needed here!", fig.width=9, fig.asp=1.2, echo = FALSE}###Adding species names and starring MIR speciesb <-left_join(b, names %>%distinct(), by ="SPECIES_CD") %>% dplyr::mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0("*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME))) #Factor re-order for aesthetics b <- b %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(avMortOld), 0, avMortOld), .desc =FALSE)) plt1 <- b %>%ggplot(aes(x = avMortOld, y = SPECIES_NAME, group =interaction(SPECIES_CD, analysis_group), color = analysis_group)) +geom_point( position =position_dodge(width =0.3)) +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')")))+geom_errorbar(aes(xmin = avMortOld - SE_avMortOld, xmax = avMortOld + SE_avMortOld), width =0.1, position =position_dodge(width =0.3)) +labs(y ="Species", x ="Old Mortality (%)") +theme_Publication(base_size =10) +facet_grid(~YEAR) +scale_x_continuous(expand =expansion(mult =c(0, 0))) +theme(strip.text =element_text(face ="italic"))+scale_color_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "NCRMP + DRM"), name ="") +scale_linetype_manual(values =c("solid", "dashed"), guide ="none") +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) print(plt1)```## Overall Max Diameter Comparision```{r overall Max_Dim, fig.cap = "Figure 10. Caption needed here too!", fig.width=9, fig.asp=1.2, echo = FALSE}spec_unq <-unique(b$SPECIES_CD)###Adding species names and starring MIR speciesc <-left_join(c, names %>%distinct(), by ="SPECIES_CD") %>% dplyr::mutate(SPECIES_NAME =case_when( SPECIES_CD %in% MIR_species ~paste0("*", SPECIES_NAME),TRUE~as.character(SPECIES_NAME))) #Factor re-order for aesthetics c <- c %>%mutate(SPECIES_NAME =fct_reorder(SPECIES_NAME, if_else(is.na(avMaxdiam), 0, avMaxdiam), .desc =FALSE))c <- c %>%filter(SPECIES_CD %in% spec_unq) plt1 <- c %>%ggplot(aes(x = avMaxdiam, y = SPECIES_NAME, group =interaction(SPECIES_CD, analysis_group), color = analysis_group)) +geom_point( position =position_dodge(width =0.3)) +scale_y_discrete(labels =function(x) parse(text =paste0("italic('", x, "')")))+geom_errorbar(aes(xmin = avMaxdiam - SE_maxdiam, xmax = avMaxdiam + SE_maxdiam), width =0.1, position =position_dodge(width =0.3)) +labs(y ="Species", x ="Average Mean Colony Size") +theme_Publication(base_size =10) +facet_grid(~YEAR) +scale_x_continuous(expand =expansion(mult =c(0, 0))) +theme(strip.text =element_text(face ="italic"))+scale_color_manual(values =c("#0072B2", "#D55E00"), labels =c("MIR", "Outside"), name ="") +scale_linetype_manual(values =c("solid", "dashed"), guide ="none") +theme(strip.text =element_text(size =14, face ="bold"),axis.text.y =element_text(size =11),axis.title =element_text(size =13),legend.position ="bottom",legend.text =element_text(size =10),panel.spacing =unit(1, "lines") ) print(plt1)```## **Supplemental Information**### M:IR Restoration Sites Benthic Cover Composition```{r zone_fig, fig.cap = "Figure 11. Mean scleractinan and macroalgal cover at each of the eight M:IR restoration sites in 2022 and 2024.", fig.width=12, fig.asp=0.9, echo = FALSE}###Start from the end of Translating_LPI_data##Have this dataset, has the MIR sites and analysis groundstmp <-read_csv("../Project/data/FK2022_24_MIR_NCRMP_bcov_dat1_NK.csv") %>%filter(survey_type =="MIR")##But in order to add the MIR groups, I need to add the MAPGRID NRs###Pull out the MIR_zones from the data gridMIR_zones <-read.csv("../Project/data/MIR_zones.csv") %>%select(MAPGRID_NR, MIR_zone)##Bring in the PSU/Mapgrid Link, copied from earlier part of Translating_LPI_datadf_22 <-read_csv("../Project/data/NCRMP_FKEYS2022_Benthic_Data01_BenthicCover_points.csv")df_24 <-read_csv("../Project/data/FLK_MIR_2024_benthic_cover.csv")tmp2 <-full_join(df_22, df_24) %>%select(REGION, YEAR, PRIMARY_SAMPLE_UNIT, MAPGRID_NR) %>%left_join(., MIR_zones) %>%unique()###Bring it back to the original data and join it allzones <- tmp %>%left_join(., tmp2 %>%select(PRIMARY_SAMPLE_UNIT, YEAR, MIR_zone)) %>%##Manuall rewriting those in 2022 that fell outside the exact boundaries but were still considered MIR dplyr::mutate(MIR_zone =case_when(PRIMARY_SAMPLE_UNIT ==9080~"Carysfort North", PRIMARY_SAMPLE_UNIT ==9079~"Carysfort North", PRIMARY_SAMPLE_UNIT ==9054~"Eastern Dry Rocks",TRUE~ MIR_zone)) %>%filter(PRIMARY_SAMPLE_UNIT !=9151) #blank LPI, survey was pulled##Now copying from Translating_LPI_StRS forward. This was slightly editied to be just for MIR data (no other analysis_group, and with MIR_zone)#Step 1: Import the data, calculate proportional cover#~~~~~~~~~~~~~~~~~~~~~~~~~~~df <- zones %>%mutate(prp_cov = cat_p / LPI_total) %>%filter(analysis_group =="MIR_GRP") #Filtered again because those sites that we rewrote earlier aren't used in this analysis## Ntot given by Dione. Need to take out CFK04 (only for 2022) because no inside outsidentot <-read_csv("../Project/data/ncrmp_mir_2022_coral_ntot.csv") %>% dplyr::mutate(mtot =250) %>% dplyr::rename(ntot = nht)ntot <-full_join( ntot %>% dplyr::mutate(YEAR =2022) %>% dplyr::filter(strat_cora !="CFK04"), ntot %>% dplyr::mutate(YEAR =2024)) %>%filter(analysis_group =="MIR_GRP")##MIR Zones each year that have NTOTs##This dataset was written manually and included writing out for each zone which strats were sampled in that year.##This step is necessary so that it is only averaging across strats that existed in that zonezones_ntot <-read_csv("../Project/data/NTOT_Mir_Zones.csv")ntot_filtered <-full_join(zones_ntot, ntot)####Step 2: Stratum-Level Density Estimates#~~~~~~~~~~~~~~~~~~~~~~~~~~~#straight transcription of math from DS#weightingdens_estimates <- df %>%group_by(analysis_group, strat_cora, YEAR, COVER_CAT_CD, MIR_zone) %>%summarise(n =n(),smprp =sum(prp_cov, na.rm =TRUE) ) %>%mutate(avp = smprp / n,var_avp =ifelse(n >1, (n / (n -1)) * avp * (1- avp), 0), ##updated from Dione's math to set variance as 0 when n=1 instead of dividing by 0s1 = var_avp ) %>%##add ntot for each stratleft_join(., ntot_filtered) %>%## summarise ngrtot avaliable ntot on each strat/analysis groupleft_join(., ntot_filtered %>%group_by(MIR_zone, YEAR) %>%summarise(ngrtot =sum(ntot))) %>%## weightedmutate(wh = ntot/ngrtot)dens_estimates <- dens_estimates %>%mutate(wh = ntot / ngrtot,fn = n / ntot,vbar_p = (1- fn) * s1 / n,se_p =sqrt(vbar_p),wavp_tmp = wh * avp,wvbar_p = wh^2* vbar_p )####Step 3: Domain-Level Density Estimates#~~~~~~~~~~~~~~~~~~~~~~~~~~~#math transcribed directly from DSdomain_estimates <- dens_estimates %>%group_by(analysis_group, YEAR, COVER_CAT_CD, MIR_zone) %>%summarise(wavp =sum(wavp_tmp),wvbar_p =sum(wvbar_p),sem =sd(wavp_tmp)/sqrt(length(wavp_tmp)),n =sum(n),nstrat =n() ) %>%mutate(se_wp =sqrt(wvbar_p) ) %>%mutate(across(c(wavp, se_wp), round, 5))### Covercat_codes <-read_csv("../Project/data/bcov_cat_codes.csv") %>% dplyr::rename(cover_group = CODE)cvr <- domain_estimates %>% dplyr::rename(cover_group = COVER_CAT_CD,REGION = analysis_group,avCvr = wavp,var = wvbar_p,n_sites = n ) %>%# dplyr::mutate(YEAR = 2022) %>%left_join(cat_codes %>%select (cover_group:COV_CAT_B))###Formatting Data for Combined Macroalgal/Hard Coral plotcvr_analysis <- cvr %>%group_by(REGION, COV_CAT_B, YEAR, MIR_zone) %>%# filter(COV_CAT_A == "HCORA" | COV_CAT_A == "MACAL") %>%summarise(avCvr =sum(avCvr),vars =sum(var), # Sum of variances across strata (assuming independence)SEM =sqrt(vars) # domain level standard error )pos_dodge <-position_dodge(width =0.06)cover_colors <-c("HCORS"="deeppink3", "MACAL"="#26BA41")cover_labels <-c("HCORS"="Coral", "MACAL"="Macroalgae")facet_labels <-c("Carysfort North"="Carysfort\nNorth","Carysfort South"="Carysfort\nSouth","Cheeca Rocks"="Cheeca\nRocks","Eastern Dry Rocks"="Eastern\nDry Rocks","Horseshoe"="Horseshoe", "Looe"="Looe\nKey","Sombrero"="Sombrero","Newfound Harbor"="Newfound\nHarbor")plt <- cvr_analysis %>%filter(COV_CAT_B %in%names(cover_colors)) %>%ggplot(aes(x =as.integer(YEAR), y = avCvr, color = COV_CAT_B)) +geom_point(size =2, position = pos_dodge) +geom_line(size =1, position = pos_dodge) +geom_errorbar(aes(ymin =pmax(avCvr - SEM, 0),ymax =pmin(avCvr + SEM, 0.5) ), width =0.1,position = pos_dodge ) +scale_color_manual(values = cover_colors, labels = cover_labels, name ="") +labs(x ="Year", y ="Benthic Cover (%)") +scale_x_continuous(breaks =c(2022, 2024)) +scale_y_continuous(limits =c(0, 0.51),expand =c(0, 0),labels = scales::label_percent(accuracy =1) ) +facet_wrap( ~MIR_zone, nrow =2,labeller =labeller(MIR_zone = facet_labels) ) +theme_Publication(base_size =15) +theme(strip.text =element_text(face ="bold.italic", size =18),axis.text.x =element_text(size =12),axis.title =element_text(size =18),legend.position ="bottom",legend.direction ="horizontal",legend.key.size =unit(1.2, "cm"),legend.margin =margin(0, 0, 0, 0, "cm"),legend.text =element_text(size =18),legend.background =element_blank(),legend.title =element_blank() ) +guides(color =guide_legend(override.aes =list(size =4)))print(plt)```## **References**Ault, J. S., Smith, S. G., Luo, J., Grove, L. J., Johnson, M. W., and Blondeau, J. (2021). Refinement of the southern Florida Reef Tract benthic habitat map with habitat use patterns of reef fish species. (NCEI Accession 0224176). NOAA National Centers for Environmental Information. Dataset. https://www.ncei.noaa.gov/archive/accession/0224176 NOAA Coral Reef Conservation Program. (2022b).National Coral Reef Monitoring Program (NCRMP) benthic community assessment survey field protocols for U.S. Atlantic: Florida, Flower Garden Banks, Puerto Rico, and U.S. Virgin Islands--2022. NOAA Coral Reef Conservation Program. https://doi.org/0.25923/0708-8333NOAA Coral Reef Conservation Program. (2022c). National Coral Reef Monitoring Program (NCRMP) coral demographics survey field protocols for U.S. Atlantic: Florida, Flower Garden Banks, Puerto Rico, U.S. Virgin Islands. 2022. NOAA Coral Reef Conservation Program. https://doi.org/10.25923/9a1r-m911NOAA National Marine Fisheries Service. (2014). Final rule. Endangered and threatened wildlife and plants: Final listing determinations on proposal to list 66 reef-building coral species and to reclassify elkhorn and staghorn corals. Federal Register, 79(175), 53851--54123.*insert fish tech memo referenced earlier*also missing some of the field protocols?